package com.houweishi.module.agentaddress.service.impl;

import java.util.List;

import com.houweishi.common.annotation.DataSource;
import com.houweishi.common.enums.DataSourceType;
import com.houweishi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.houweishi.module.agentaddress.mapper.AgentAddressMapper;
import com.houweishi.module.agentaddress.domain.AgentAddress;
import com.houweishi.module.agentaddress.service.IAgentAddressService;

/**
 * 场地管理Service业务层处理
 * 
 * @author houweishi
 * @date 2023-03-10
 */
@Service
public class AgentAddressServiceImpl implements IAgentAddressService 
{
    @Autowired
    private AgentAddressMapper agentAddressMapper;

    /**
     * 查询场地管理
     * 
     * @param id 场地管理主键
     * @return 场地管理
     */
    //切换数据源
    @DataSource(value = DataSourceType.SLAVE1)
    @Override
    public AgentAddress selectAgentAddressById(Long id)
    {
        return agentAddressMapper.selectAgentAddressById(id);
    }

    /**
     * 查询场地管理列表
     * 
     * @param agentAddress 场地管理
     * @return 场地管理
     */
    @DataSource(value = DataSourceType.SLAVE1)
    @Override
    public List<AgentAddress> selectAgentAddressList(AgentAddress agentAddress)
    {
        return agentAddressMapper.selectAgentAddressList(agentAddress);
    }

    /**
     * 新增场地管理
     * 
     * @param agentAddress 场地管理
     * @return 结果
     */
    @DataSource(value = DataSourceType.SLAVE1)
    @Override
    public int insertAgentAddress(AgentAddress agentAddress)
    {
        agentAddress.setCreateTime(DateUtils.getNowDate());
        return agentAddressMapper.insertAgentAddress(agentAddress);
    }

    /**
     * 修改场地管理
     * 
     * @param agentAddress 场地管理
     * @return 结果
     */
    @DataSource(value = DataSourceType.SLAVE1)
    @Override
    public int updateAgentAddress(AgentAddress agentAddress)
    {
        return agentAddressMapper.updateAgentAddress(agentAddress);
    }

    /**
     * 批量删除场地管理
     * 
     * @param ids 需要删除的场地管理主键
     * @return 结果
     */
    @DataSource(value = DataSourceType.SLAVE1)
    @Override
    public int deleteAgentAddressByIds(Long[] ids)
    {
        return agentAddressMapper.deleteAgentAddressByIds(ids);
    }

    /**
     * 删除场地管理信息
     * 
     * @param id 场地管理主键
     * @return 结果
     */
    @DataSource(value = DataSourceType.SLAVE1)
    @Override
    public int deleteAgentAddressById(Long id)
    {
        return agentAddressMapper.deleteAgentAddressById(id);
    }
}
